package com.guodi.map.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guodi.map.entity.MapProject;
import com.guodi.map.mapper.MapProjectMapper;
import com.guodi.map.service.IMapProjectService;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @描述：地图图层专题表 服务类
 * @作者: 代鹏刚
 * @日期: 2019-12-11
 */
@Service
public class MapProjectServiceImpl extends ServiceImpl<MapProjectMapper, MapProject> implements IMapProjectService {


    @Override
    public List<MapProject> listByEntity(MapProject mapProject) {
        LambdaQueryWrapper<MapProject> lambdaQueryWrapper = (new QueryWrapper()).lambda();
        if(StringUtils.isNotBlank(mapProject.getName())){
            lambdaQueryWrapper.like(MapProject::getName,mapProject.getName());
        }
        lambdaQueryWrapper.orderByDesc(MapProject::getIsDefault);
        lambdaQueryWrapper.orderByAsc(MapProject::getSort);
        return this.list(lambdaQueryWrapper);
    }
}